package com.mq.broadcast;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author ytj
 * @date 2024/1/17
 */
@Component
public class BroadcastProducer {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void send(Integer id){
        BroadcastMessage message=new BroadcastMessage(id);
        rabbitTemplate.convertAndSend(BroadcastMessage.EXCHANGE,null,message);
    }
}
